home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Developer's Kit 1996
/
Delphi Developer's Kit 1996.iso
/
power
/
regmax.000
/
mainform.frm
< prev
next >
Wrap
Text File
|
1995-12-22
|
22KB
|
789 lines
VERSION 2.00
Begin Form MAINFORM
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "GBLIB2.EXE Demonstration. Press F1 for Help"
ClientHeight = 6135
ClientLeft = 2340
ClientTop = 1890
ClientWidth = 7155
Height = 6825
Icon = MAINFORM.FRX:0000
Left = 2280
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6135
ScaleWidth = 7155
Top = 1260
Width = 7275
Begin Frame Fra_Info
BackColor = &H00C0C0C0&
Caption = "R&ead External Information"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00800000&
Height = 2475
Index = 3
Left = 3000
TabIndex = 18
Top = 3420
Width = 2595
Begin CommandButton btn_Read_Ext_EXE
Caption = "Read from External EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 21
Top = 480
Width = 2235
End
Begin CommandButton btn_Read_Ext_INI
Caption = "External Read INI"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 20
Top = 1080
Width = 2235
End
Begin CommandButton btn_Read_Ext_EXEINI
Caption = "Read External INI && EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 19
Top = 1740
Width = 2235
End
End
Begin Frame Fra_Info
BackColor = &H00C0C0C0&
Caption = "Wr&ite to External EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00004080&
Height = 2475
Index = 2
Left = 180
TabIndex = 14
Top = 3420
Width = 2595
Begin CommandButton btn_Write_Ext_EXE
Caption = "Write to External EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 17
Top = 480
Width = 2235
End
Begin CommandButton Btn_Write_Ext_INI
Caption = "External Write INI"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 16
Top = 1080
Width = 2235
End
Begin CommandButton btn_Write_Ext_EXEINI
Caption = "Write External INI && EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 15
Top = 1740
Width = 2235
End
End
Begin CommonDialog CMDialog
DefaultExt = "*.EXE"
Filter = "Executables *.EXE|*.EXE"
Flags = 4100
HelpFile = "GBLIB2.hlp"
Left = 6120
Top = 2460
End
Begin CommandButton btn_Check
Caption = "Self-&Check"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 2940
TabIndex = 9
Top = 2760
Width = 1215
End
Begin Frame Fra_Info
BackColor = &H00C0C0C0&
Caption = "&Read Information"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H00FF0000&
Height = 2475
Index = 1
Left = 2940
TabIndex = 6
Top = 120
Width = 2595
Begin CommandButton btn_ReadBoth
Caption = "Self-Read b&oth INI && EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 13
Top = 1740
Width = 2235
End
Begin CommandButton btn_ReadINIData
Caption = "Read &INI Information"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 11
Top = 1080
Width = 2235
End
Begin CommandButton btn_ReadRegData
Caption = "Self-Read from &EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 8
Top = 480
Width = 2235
End
End
Begin Frame Fra_Info
BackColor = &H00C0C0C0&
Caption = "Wri&te Information"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
ForeColor = &H000000FF&
Height = 2475
Index = 0
Left = 180
TabIndex = 5
Top = 120
Width = 2595
Begin CommandButton btn_WriteBoth
Caption = "Self-Wri&te to INI && EXE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 12
Top = 1740
Width = 2235
End
Begin CommandButton btn_WriteINIData
Caption = "Write &INI Information"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 10
Top = 1080
Width = 2235
End
Begin CommandButton btn_WriteRegData
Caption = "Self-Write to E&XE"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 7
Top = 480
Width = 2235
End
End
Begin CommandButton btn_ENCRYPT
Caption = "Encr&ypt"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 1560
TabIndex = 2
Top = 2760
Width = 1215
End
Begin CommandButton btn_WINSYSDIR
Caption = "&WIN/SYSDIR"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 4320
TabIndex = 0
Top = 2760
Width = 1215
End
Begin CommandButton btn_MakeAKey
Caption = "Ma&keakey"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 180
TabIndex = 1
Top = 2760
Width = 1215
End
Begin CommandButton btn_Exit
Cancel = -1 'True
Caption = "E&xit"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Arial"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 495
Left = 5760
TabIndex = 3
Top = 180
Width = 1215
End
Begin Shape sh_MainBorder
BorderColor = &H00800000&
BorderStyle = 6 'Inside Solid
BorderWidth = 3
Height = 6135
Left = 0
Top = 0
Width = 7155
End
Begin Label lbl_Copyright
Alignment = 2 'Center
BackColor = &H00C0C0C0&
Caption = "(c)1995 [GB]"
Height = 435
Left = 6000
TabIndex = 4
Top = 5460
Width = 735
WordWrap = -1 'True
End
Begin Image img_Icon
BorderStyle = 1 'Fixed Single
Height = 510
Left = 6120
Picture = MAINFORM.FRX:0302
Top = 960
Width = 510
End
Begin Menu mfile
Caption = "&File"
Begin Menu mfile_Exit
Caption = "E&xit"
End
Begin Menu mfile_About
Caption = "&About"
End
End
End
Option Explicit
' /* Modified 31/12/94 [GB] */
' /* Created 31/12/94 [GB] */
' //Form variable for messages//
Dim msg As String
Sub btn_Check_click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
Dim i_RetVal As Integer
Dim msg As String
i_RetVal = IsUnRegistered()
If i_RetVal = 0 Then
msg = "Registration cross-checks out OK."
Else
msg = "Registration cross-check fails." & Chr$(10)
msg = msg & Check_ErrorString(i_RetVal)
End If
MsgBox msg, 64, "CheckRegistered() Report"
End Sub
Sub btn_ENCRYPT_Click ()
' /* Modified 14/01/95 [GB] */
' /* Created 14/01/95 [GB] */
' //*** Warning *** Alpha data only!//
Dim Answer As String
Dim sz As String
Dim ALen As Integer
' //Make enough room//
sz = String$(255, 0)
Answer = InputBox$("Type in a string", "EncryptIt Demo", "Gordon Bamber")
' //Cancel?//
If Answer = "" Then Exit Sub
' //Check if too long//
If Len(Answer) > 254 Then
sz = Left$(Answer, 254)
Else
sz = Answer
End If
' //Do the deed//
Encryptit sz, ALen
' //Chop off the surplus//
sz = Left$(sz, ALen)
MsgBox Answer & Chr$(10) & Chr$(10) & "has been encrypted to" & Chr$(10) & Chr$(10) & sz, 64, "Encrypt"
End Sub
Sub btn_Exit_Click ()
' /* Modified 30/12/94 [GB] */
' /* Created 30/12/94 [GB] */
End
End Sub
Sub btn_MakeAKey_Click ()
' /* Modified 31/12/94 [GB] */
' /* Created 31/12/94 [GB] */
' //Simple function. Possible crosscheck on USERNAME/USERORG? //
Dim Answer As Long
Dim sz As String
sz = InputBox$("Type in a string", "MakeAKey Demo", "Gordon Bamber")
' //Cancel?//
If sz = "" Then Exit Sub
' //Result has to be a Long Integer Type//
Answer = MakeAKey(sz)
MsgBox "Key generated is " & Format$(Answer), 64, "MakeAKey"
End Sub
Sub btn_Read_Ext_EXE_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Read from External EXE file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
Dim x As Integer
x = MsgBox("Show Date and Expiry Information?", 36, "ReadRegData")
If x = 6 Then
DisplayRegInfoWithExpiry
Else
DisplayRegInfo
End If
End Sub
Sub btn_Read_Ext_EXEINI_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Read from External EXE and INI file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
Dim i_RetVal As Integer
i_RetVal = IsUnRegistered()
Dim msg As String
msg = ""
Select Case i_RetVal
Case Is >= 16384
msg = msg & "Error in INI-File" & Chr$(10)
Case Is >= 8192
msg = msg & "Error in EXE-File"
End Select
msg = msg & Chr$(10) & "USERNAME=" & USERNAME
msg = msg & Chr$(10) & "USERORG=" & USERORG
msg = msg & Chr$(10) & "INI_USERNAME=" & INI_USERNAME
msg = msg & Chr$(10) & "INI_USERORG=" & INI_USERORG
msg = msg & Chr$(10) & "Errorcode is: " & Format$(i_RetVal)
If i_RetVal = 0 Then msg = msg & Chr$(10) & "Registration confirmed OK"
MsgBox msg, 48, "Read both INI and EXE"
End Sub
Sub btn_Read_Ext_INI_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Read from External INI file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
Dim i_RetVal As Integer
i_RetVal = DisplayRegInfoFromINI()
End Sub
Sub btn_ReadBoth_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
sz_EXEPath = Get_sz_CurrentEXEPath()
Dim i_RetVal As Integer
i_RetVal = IsUnRegistered()
Dim msg As String
msg = ""
Select Case i_RetVal
Case Is >= 16384
msg = msg & "Error in INI-File" & Chr$(10)
Case Is >= 8192
msg = msg & "Error in EXE-File"
End Select
msg = msg & Chr$(10) & "USERNAME=" & USERNAME
msg = msg & Chr$(10) & "USERORG=" & USERORG
msg = msg & Chr$(10) & "INI_USERNAME=" & INI_USERNAME
msg = msg & Chr$(10) & "INI_USERORG=" & INI_USERORG
msg = msg & Chr$(10) & "Errorcode is: " & Format$(i_RetVal)
If i_RetVal = 0 Then msg = msg & Chr$(10) & "Registration confirmed OK"
MsgBox msg, 48, "Read both INI and EXE"
End Sub
Sub btn_ReadINIData_Click ()
' /* Modified 14/01/95 [GB] */
' /* Created 14/01/95 [GB] */
sz_EXEPath = Get_sz_CurrentEXEPath()
Dim i_RetVal As Integer
i_RetVal = DisplayRegInfoFromINI()
End Sub
Sub btn_ReadRegData_Click ()
' /* Modified 31/12/94 [GB] */
' /* Created 31/12/94 [GB] */
Dim x As Integer
sz_EXEPath = Get_sz_CurrentEXEPath()
' //Quit out in development mode//
If IsVBRunning() = 0 Then
x = MsgBox("Show Date and Expiry Information?", 36, "ReadRegData")
If x = 6 Then
DisplayRegInfoWithExpiry
Else
DisplayRegInfo
End If
Else
DevMsg
Exit Sub
End If
End Sub
Sub btn_WINSYSDIR_Click ()
' /* Modified 14/01/95 [GB] */
' /* Created 14/01/95 [GB] */
ShowWinDir
ShowSysDir
End Sub
Sub btn_Write_Ext_EXE_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Write to External EXE file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
EXE = True
INI = False
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
' //No more writes in this instance!//
DisableWrites
End Sub
Sub btn_Write_Ext_EXEINI_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Write to External EXE and INI file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
EXE = True
INI = True
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
' //No more writes in this instance!//
DisableWrites
End Sub
Sub Btn_Write_Ext_INI_Click ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
CMDialog.DialogTitle = "Write to External INI file"
CMDialog.Action = 1
sz_EXEPath = CMDialog.Filename
If sz_EXEPath = "" Then
sz_EXEPath = Get_sz_CurrentEXEPath()
Exit Sub
End If
EXE = False
INI = True
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
End Sub
Sub btn_WriteBoth_Click ()
' /* Modified 14/01/95 [GB] */
' /* Created 14/01/95 [GB] */
EXE = True
INI = True
sz_EXEPath = Get_sz_CurrentEXEPath()
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
' //No more writes in this instance!//
DisableWrites
End Sub
Sub btn_WriteINIData_Click ()
' /* Modified 14/01/95 [GB] */
' /* Created 14/01/95 [GB] */
EXE = False
INI = True
sz_EXEPath = Get_sz_CurrentEXEPath()
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
End Sub
Sub btn_WriteRegData_Click ()
' /* Modified 30/12/94 [GB] */
' /* Created 30/12/94 [GB] */
' //Quit out in development mode//
If IsVBRunning() <> 0 Then
DevMsg
Exit Sub
End If
EXE = True
INI = False
sz_EXEPath = Get_sz_CurrentEXEPath()
' //Hide the main form//
Me.Hide
DoEvents
' //Show regform non-modally//
Regform.Show
' //No more writes in this instance!//
DisableWrites
End Sub
Sub DisableWrites ()
' /* Modified 15/01/95 [GB] */
' /* Created 15/01/95 [GB] */
btn_WriteINIData.Enabled = False
btn_WriteRegData.Enabled = False
btn_WriteBoth.Enabled = False
btn_Write_Ext_EXE.Enabled = False
btn_Write_EXt_INI.Enabled = False
btn_Write_EXt_EXEINI.Enabled = False
fra_Info(0).Caption = "EXE has been modified"
fra_Info(2).Caption = "Writing now disabled"
End Sub
Sub Form_Load ()
' /* Modified 11/01/95 [GB] */
' /* Modified 06/01/94 [GB] */
' /* Modified 02/01/95 [GB] */
' //Place the form correctly on the screen//
Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
On Error Resume Next
' //Check if already running//
If APP.PrevInstance = True Then
MsgBox APP.EXEName & " is already running. Click OK.", 48, APP.EXEName & " Information"
AppActivate "GBLIB2.EXE Demonstration. Press F1 for Help"
DoEvents
End
End If
' //Use the current application//
sz_EXEPath = Get_sz_CurrentEXEPath()
' //Skip the following if in development mode//
If IsVBRunning() = 0 Then ShowSplash
End Sub
Sub mfile_About_Click ()
' /* Modified 03/01/95 [GB] */
' /* Created 03/01/95 [GB] */
msg = "The REGMAX/GBLIB2 Project" & Chr$(10) & Chr$(10)
msg = msg & "Source code Copyright" & Chr$(10)
msg = msg & "(c)1994/5 Gordon Bamber" & Chr$(10) & Chr$(10)
msg = msg & "Distributed to Visual Basic V3.0" & Chr$(10)
msg = msg & "developers as FREEWARE"
MsgBox msg, 64, "About"
End Sub
Sub mfile_Exit_Click ()
' /* Modified 03/01/95 [GB] */
' /* Created 03/01/95 [GB] */
End
End Sub